from appengine_django.models import BaseModel
from google.appengine.ext import db
#from django import newforms as forms 

class Hill(BaseModel):
    name = db.StringProperty('Hill name', required=True)
    snowAtTop = db.FloatProperty(required=True)
    snowAtBottom = db.FloatProperty(required=True)
    lastUpdate = db.DateTimeProperty(auto_now_add=True, required=True)
    def __unicode__(self):
        return "%s" % self.name 

class Run(BaseModel):
    name = db.StringProperty('Run name', required=1)
    typeRunning = db.StringProperty('Type',choices=['verte','bleue', 'rouge', 'noire'])
    state = db.BooleanProperty('Ouvert')
    hill = db.ReferenceProperty(Hill)
    def __unicode__(self):
        return "Station %s / %s" % (self.hill.name , self.name)
    
class Lift(BaseModel):
    name = db.StringProperty('Lift name', required=1)
    state = db.BooleanProperty('Ouvert')
    run = db.ReferenceProperty(Run)
    
class Feedback(BaseModel):
    date = db.DateTimeProperty(auto_now_add=True)
    grade = db.IntegerProperty()
    checks = db.StringListProperty("checks")#,choices=["rocky", "powder", "artificial snow", "hard", "soup"], default=[]
    comment = db.StringProperty('Comment')
    run = db.ReferenceProperty(Run)    

class UserRight(BaseModel):
    mail = db.StringProperty('Mail',required=1)
    superadmin = db.BooleanProperty('Is super', default=[False])
    hill = db.ReferenceProperty(Hill)